﻿/*
 * Crée par SharpDevelop.
 * Utilisateur: Propriétaire
 * Date: 21/01/2012
 * Heure: 09:21
 * 
 * Pour changer ce modèle utiliser Outils | Options | Codage | Editer les en-têtes standards.
 */
using System;
using System.Drawing;
using System.Windows.Forms;
//using System.Diagnostics;
//using System.Media;
//using System.Collections.Generic;

namespace IPD_GeneralLib
{
    /// <summary>
    /// Description of Affiche_enreg.
    /// </summary>
public partial class Affiche_enregSms : Form
 {
    
    internal static int AFFENRindexenreg = -1 ;
    internal static int AFFENRmaxnumenreg = -1 ;
    
    private static bool bIncomboautoselect = false ;

    
public Affiche_enregSms()
    {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();
            
            //
            // TODO: Add constructor code after the InitializeComponent() call.
            //
        }
void Affiche_enregSmsLoad(object sender, EventArgs e)
 {
  this.Text += " Sms" ;
 
  adaptObjectsForm2DataBaseType() ;
}

void adaptObjectsForm2DataBaseType()
 {
   int jj = 0 ;
   comboBox1.Items.Clear() ;
   for (int ii = 0 ; ii < AFFENRmaxnumenreg ; ii++)
      {
        jj = ii + 1 ;
        comboBox1.Items.Add(jj.ToString("0000")) ;
     }
        
   		displaysms() ;
}


void displaysms()
 {
// SMS_ColDateSent 1, SMS_ColDateReceive 2, SMS_ColStatus 3, SMS_ColFolder 4, SMS_ColPhone 5, SMS_ColMsg 6
   textBox21.Text = IPD_GeneralLib.IPDGeneral.VirtualArray_SMS[AFFENRindexenreg, IPD_GeneralLib.IPDGeneral.SMS_ColDateSent] ;
   textBox41.Text = IPD_GeneralLib.IPDGeneral.VirtualArray_SMS[AFFENRindexenreg, IPD_GeneralLib.IPDGeneral.SMS_ColDateReceived] ;
   textBox20.Text = IPD_GeneralLib.IPDGeneral.VirtualArray_SMS[AFFENRindexenreg, IPD_GeneralLib.IPDGeneral.SMS_ColStatus] ;
   textBox19.Text = IPD_GeneralLib.IPDGeneral.VirtualArray_SMS[AFFENRindexenreg, IPD_GeneralLib.IPDGeneral.SMS_ColFolder] ;
   textBox17.Text  = IPD_GeneralLib.IPDGeneral.VirtualArray_SMS[AFFENRindexenreg, IPD_GeneralLib.IPDGeneral.SMS_ColPhone] ;
   textBox16.Text = IPD_GeneralLib.IPDGeneral.VirtualArray_SMS[AFFENRindexenreg, IPD_GeneralLib.IPDGeneral.SMS_ColMsg].Replace("\n", "\r\n") ;
   bIncomboautoselect = true ;
   comboBox1.SelectedIndex = AFFENRindexenreg ;       
   bIncomboautoselect = false ;
}

// Next record
void Button3Click(object sender, EventArgs e)
 {
   AFFENRindexenreg += 1 ;
  
   if (AFFENRindexenreg > AFFENRmaxnumenreg - 1)
      {
  	    AFFENRindexenreg = AFFENRmaxnumenreg - 1 ;
  	    return ;
     }
  
  displaysms() ;
}
        
// Previous record
void Button2Click(object sender, EventArgs e)
 {
   AFFENRindexenreg -= 1 ;
  
   if (AFFENRindexenreg < 0)
     {
      AFFENRindexenreg = 0 ;
      return ;
    }

  displaysms() ;
}
        
// Goto last record
void Button4Click(object sender, EventArgs e)
 {
   if (AFFENRindexenreg == AFFENRmaxnumenreg - 1)
        return ; // already last record
  
   AFFENRindexenreg = AFFENRmaxnumenreg - 1 ;
 
  displaysms() ;
}
        
// Goto first record
void Button5Click(object sender, EventArgs e)
 {
   if (AFFENRindexenreg == 0) // Already first record
  	   return ;
  
   AFFENRindexenreg = 0 ;
 
  displaysms() ;
}
        
// Close Form
void Button1Click(object sender, EventArgs e)
 {
   Close() ;
}
        
void ComboBox1SelectedIndexChanged(object sender, EventArgs e)
 {
   if (bIncomboautoselect == true)
       return ;

   AFFENRindexenreg = comboBox1.SelectedIndex ;

   bIncomboautoselect = true ;
   displaysms() ;
   bIncomboautoselect = false ;
}

    }
}
